package tests;

import common.Utils;
import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

public class DetailPage extends Utils {

    public static String url = "http://8.137.19.140:9090/blog_detail.html?blogId=21430";

    public DetailPage() {

        super(url);
    }
    //检查页面元素是否正常

    public void DetaiSuc(){
        driver.findElement(By.cssSelector("#h2-u5728u8FD9u91CCu5199u4E0Bu4E00u7BC7u535Au5BA2"));
        driver.findElement(By.cssSelector("body > div.container > div.right > div > div.date"));
    }

    public void DetaiSuc1(){

        driver.findElement(By.cssSelector("body > div.container > div.left > div > a")).click();
        //设置显示等待
        WebDriverWait wait = new WebDriverWait(driver, 2);
        //通过url检查是否跳转页面
        wait.until(ExpectedConditions.urlToBe("https://gitee.com/bubble-fish666/class-java45"));

        // 如果 URL 跳转成功，打印成功信息
        //System.out.println("页面跳转成功，当前 URL: " + driver.getCurrentUrl());
        driver.navigate().back();
    }

}
